<template>
	<view class="uni-tabbar">
		<view class="uni-tabbar2">
			<view class="uni-tabbar-border"></view>
			<view class="uni-tabbar__item" @click="goTo(0)">
				<view clss="uni-tabbar__bd">
					<view class="uni-tabbar__icon">
						<img :src="index_p2==0?require('static/image/index_black.png'):require('static/image/index_gray.png')">
					</view>
					<view class="uni-tabbar__label">首页</view>
				</view>
			</view>
			<view class="uni-tabbar__item" @click="goTo(1)">
				<view clss="uni-tabbar__bd">
					<view class="uni-tabbar__icon">
						<img :src="require('static/image/classify_gray.png')">
					</view>
					<view class="uni-tabbar__label">积分商城</view>
				</view>
			</view>
			<view class="uni-tabbar__item" @click="goTo(2)">
				<view clss="uni-tabbar__bd">
					<view class="uni-tabbar__icon">
						<img :src="index_p2==2?require('static/image/cart_media.png'):require('static/image/media.png')">
					</view>
					<view class="uni-tabbar__label">房象传媒</view>
				</view>
			</view>
			<view class="uni-tabbar__item" @click="goTo(3)">
				<view clss="uni-tabbar__bd">
					<view class="uni-tabbar__icon">
						<img :src="index_p2==3?require('static/image/user_black.png'):require('static/image/user_gray.png')">
					</view>
					<view class="uni-tabbar__label">我的</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			index_p2:Number
		},
		data() {
			return {
				index:0
		}
	},
		methods: {
			goTo(name){
				if(name == 0){
					uni.reLaunch({
						url: "/pages/index/index"
					})
				}
				if(name == 1){
					uni.redirectTo({
						url: "/pages/store/index"
					})
					return true;
				}
				if(name == 2){
					uni.reLaunch({
						url: "/pages/index/transmit/Transmit"
					})
				}
				if(name == 3){
					uni.reLaunch({
						url: "/pages/member/index/index"
					})
				}
			}
		}
	}
</script>

<style>
	.uni-tabbar{
		box-sizing: border-box;
		position: fixed;
		left: 0;
		bottom: 0;
		width: 100%;
		z-index: 998;
	}
	
	.uni-tabbar .uni-tabbar2{
		display: flex;
		background-color: rgb(255, 255, 255);
		padding-bottom: env(safe-area-inset-bottom);
	}
	
	.uni-tabbar .uni-tabbar2 .uni-tabbar-border{
		background-color: rgba(0, 0, 0, 0.33);
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
		height: 1px;
		-webkit-transform: scaleY(.5);
		transform: scaleY(.5);
	}
	
	.uni-tabbar .uni-tabbar2 .uni-tabbar__item{
		display: flex;
		flex: 1;
		display: -webkit-box;
		display: -webkit-flex;
		-webkit-box-pack: center;
		-webkit-justify-content: center;
		justify-content: center;
		-webkit-box-align: center;
		-webkit-align-items: center;
		align-items: center;
		-webkit-box-orient: vertical;
		-webkit-box-direction: normal;
		-webkit-flex-direction: column;
		flex-direction: column;
		-webkit-box-flex: 1;
		-webkit-flex: 1;
		font-size: 0;
		text-align: center;
		-webkit-tap-highlight-color: rgba(0,0,0,0);
	}
	.uni-tabbar .uni-tabbar__bd {
		position: relative;
		height: 50px;
		-webkit-flex-direction: column;
		flex-direction: column;
		cursor: pointer;
		
		display: flex;
		-webkit-box-pack: center;
		-webkit-justify-content: center;
		justify-content: center;
		-webkit-box-align: center;
		-webkit-align-items: center;
		align-items: center;
		-webkit-box-orient: vertical;
		-webkit-box-direction: normal;
	}
	
	.uni-tabbar .uni-tabbar__icon {
		position: relative;
		display: inline-block;
		margin-top: 5px;
		width: 24px;
		height: 24px;
	}
	.uni-tabbar .uni-tabbar__icon img {
		width: 100%;
		height: 100%;
	}
	
	.uni-tabbar .uni-tabbar__label {
	    position: relative;
	    text-align: center;
	    font-size: 10px;
	    line-height: 1.8;
		color: rgb(51, 51, 51);
		    font-size: 10px;
	}

	.active {
		background: #fd7522;
		border: 1px solid #fd7522;
		color: #fff;
 	}
</style>
